#include <stdio.h>

int main(void)
{
    int space  = 0;
    int letter = 0;
    int other  = 0;

    int ch;
    while(1)
    {
        ch = getchar();

        // 当输入#时，结束
        if(ch == '#')
            break;

        // 当用户按下ctrl+d时，getchar()返回EOF
        // if(ch == EOF)
        //     break;

        switch(ch)
        {
        case ' ':
            space++;
            break;

        case 'a' ... 'z':
        case 'A' ... 'Z':
            letter++;
            break;

        default:
            other++;
        }
    }

    printf("空格: %d\n", space);
    printf("字母: %d\n", letter);
    printf("其他: %d\n", other);

    return 0;
}